home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 1 / CU Amiga Magazine CD-ROM Special Edition (1995)(EMAP Images)(GB)[Issue 1995-11].iso / Aminet / comm / tcp / AmiTCPsesn1_1.lha / AmiTCP_session-1.1 / c / nntpcopy.rexx < prev    next >
OS/2 REXX Batch file  |  1995-06-16  |  1KB  |  44 lines

  1. /*
  2.  * nntpcopy version 1.1
  3.  *
  4.  * ARexx script to copy a news article into uunews:NNTPSpoolDir
  5.  * A unique filename is created before copying the article 
  6.  * Usage: nntpcopy <article>
  7.  *
  8.  * Written by David Jameson (dave@freeside.thegap.com), 1994.
  9.  */
  10.  
  11. arg args
  12.  
  13. /* Open RexxSupport library */
  14.  
  15. if ~show('L', 'rexxsupport.library') then do
  16.     if addlib('rexxsupport.library', 0, -30, 0) then
  17.         say 'added rexxsupport.library'
  18.     else do
  19.         say 'failed to open rexxsupport.library'
  20.         exit 10
  21.     end
  22. end
  23.  
  24. date = date()
  25. parse var date day month year .
  26.  
  27. time = time()
  28. parse var time hour ':' min ':' sec
  29. filename = 'article.'||hour||'.'||min||'.'||sec||'.'||day||month||year
  30.  
  31. if exists('uunews:NNTPSpoolDir/'||filename) then do
  32.     say 'Error: temporary file already exists'
  33.     exit 20
  34. end
  35.  
  36. /* Copy file into NNTPSpoolDir */
  37.  
  38. address command
  39. 'copy' args 'uunews:NNTPSpoolDir/'||filename||' >t:'||filename
  40. ret_val = statef('t:'||filename)    /* major kludge... */
  41. parse var ret_val type size ignore
  42. if size ~= 0 then exit 10    /* copy failed */
  43. exit 0
  44.